const Product = require('../../../table/mongo/product');

module.exports = async function (req, res) {
    let data = req.body;
    console.log(data)
    try {
        let result = await Product.findById(data.id);
        result.name = data.name;
        result.price = data.price;
        result.detail = data.detail;
        result.want = data.want;
        await Product.update({_id:data.id}, result);
        res.success("编辑成功",{});
    } catch (error) {
        console.log(error);
        res.error("编辑失败")
    }
}